const td = document.querySelectorAll('td')
td.forEach(item => {
  item.addEventListener('click', function () {
    this.style.backgroundColor = 'red'
  })
})